package cz.muni.fi.pb138.eis_core;

import java.util.List;
import javax.xml.xquery.XQException;

/**
 * Provides persistence for ArtworkEntity
 * 
 * @author Jakub Senko
 */
public interface ArtworkManager
{
    /**
     * Adds artwork into database.
     * 
     * @param entity Artworkt to be added into database
     * @throws XQException An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
     */
    public void create(ArtworkEntity entity) throws XQException;
    
    /**
     * Selects artwork, that is selected by ID from database.
     * 
     * @param id id of the wanted artwork
     * @return wanted artwork
     * @throws XQException An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
     */
    public ArtworkEntity getById(long id) throws XQException;
    
    /**
     * Creates list of artworks, which are in database.
     * 
     * @return list of wanted artworks
     * @throws XQException An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
     */
    public List<ArtworkEntity> getAll() throws XQException;
    
    /**
     * Deletes artwork selected by ID from database.
     * 
     * @param entity artwork to be deleted from database
     * @return true if artwork was deleted
     *         false if operation failed
     * @throws XQException An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
     */
    public boolean delete(ArtworkEntity entity) throws XQException;
}
